/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/database/SpPimHandler.cpp,v 1.6 2003/11/21 12:39:24 itsme Exp $
 *
 *
 *  this handles dialing from the contacts plugin.
 *
 */

#include "CPhone.h"         // include this first, to avoid 'new' error with stl
#include "debug.h"

#include "CPhoneDlg.h"

#include "SpPimHandler.h"
#include "stringutils.h"

#include "SysContacts.h"

SpPimHandler::SpPimHandler()
{
}

SpPimHandler::~SpPimHandler()
{
}

// todo: display dialog presenting the user a choice of numbers
void SpPimHandler::DialObjectId(CEOID oid)
{
    SysContacts ctx;
    ctx.Open();

    TCHAR wnumber[64];
    if (ctx.FindPreferredNumber(oid, wnumber, 64))
    {
        debug("preferred nr: %ls\n", wnumber);
        debug("dlg.wnd=%08lx\n", theApp.m_dlg->m_hWnd);

        theApp.m_dlg->ClearPartner();
        theApp.m_dlg->SetNumber(ToString(wnumber));
        theApp.m_dlg->SetForegroundWindow();
    }
}

